#ifndef Utility_Date_Time_h
#define Utility_Date_Time_h

namespace serika
{
	namespace ut
	{
		class DateTime
		{
		public:
			~DateTime() {}

			DateTime();
			DateTime(int millisecond, int second, int minute, int hour, int day, int month, int year);
			DateTime(const DateTime& dateTime);
			DateTime& operator = (const DateTime& dateTime);

		public:
			void Assign(int millisecond, int second, int minute, int hour, int day, int month, int year);
			//void FromDw(DWORD dw);

			void Millisecond(int millisecond) { this->millisecond = millisecond; }
			int Millisecond() const { return this->millisecond; }

			void Second(int second) { this->second = second; }
			int Second() const { return this->second; }

			void Minute(int minute) { this->minute = minute; }
			int Minute() const { return this->minute; }

			void Hour(int hour) { this->hour = hour; }
			int Hour() const { return this->hour; }

			void Day(int day) { this->day = day; }
			int Day() const { return this->day; }

			void Month(int month) { this->month = month; }
			int Month() const { return this->month; }

			void Year(int year) { this->year = year; }
			int Year() const { return this->year; }

		public:
			bool operator < (const DateTime& dateTime) const;
			bool operator == (const DateTime& dateTime) const;

		private:
			int millisecond;
			int second;
			int minute;
			int hour;
			int day;
			int month;
			int year;
		};

		inline DateTime::DateTime()
		{
			this->Assign(0, 0, 0, 0, 0, 0, 0);
		}

		inline DateTime::DateTime(int millisecond, int second, int minute, int hour, int day, int month, int year)
		{
			this->Assign(millisecond, second, minute, hour, day, month, year);
		}

		inline DateTime::DateTime(const DateTime& dateTime)
		{
			this->Assign(dateTime.millisecond, dateTime.second, dateTime.minute, dateTime.hour,
				dateTime.day, dateTime.month, dateTime.year);
		}

		inline void DateTime::Assign(int millisecond, int second, int minute, int hour, int day, int month, int year)
		{
			this->millisecond = millisecond;
			this->second = second;
			this->minute = minute;
			this->hour = hour;
			this->day = day;
			this->month = month;
			this->year = year;
		}

		//inline void DateTime::FromDw(DWORD dw)
		//{
		//	this->Assign(0, 0, 0, 0, 0, 0, 0);

		//	this->millisecond = dw % 1000;
		//	dw -= this->millisecond;
		//	if (dw == 0)
		//	{
		//		return;
		//	}
		//	dw /= 1000;

		//	this->second = dw % 60;
		//	dw -= this->second;
		//	if (dw == 0)
		//	{
		//		return;
		//	}
		//	dw /= 60;

		//	this->minute = dw % 60;
		//	dw -= this->minute;
		//	if (dw == 0)
		//	{
		//		return;
		//	}
		//	dw /= 60;

		//	this->hour = dw % 24;
		//	dw -= this->hour;

		//	this->day = dw;
		//}

		inline bool DateTime::operator < (const DateTime& dateTime) const
		{
			if (this->year < dateTime.year) { return true; }
			if (this->year > dateTime.year) { return false; }
			if (this->month < dateTime.month) { return true; }
			if (this->month > dateTime.month) { return false; }
			if (this->day < dateTime.day) { return true; }
			if (this->day > dateTime.day) { return false; }
			if (this->hour < dateTime.hour) { return true; }
			if (this->hour > dateTime.hour) { return false; }
			if (this->minute < dateTime.minute) { return true; }
			if (this->minute > dateTime.minute) { return false; }
			if (this->second < dateTime.second) { return true; }
			if (this->second > dateTime.second) { return false; }
			return this->millisecond < dateTime.millisecond;
		}

		inline bool DateTime::operator == (const DateTime& dateTime) const
		{
			return this->millisecond == dateTime.millisecond &&
				this->second == dateTime.second &&
				this->minute == dateTime.minute &&
				this->hour == dateTime.hour &&
				this->day == dateTime.day &&
				this->month == dateTime.month &&
				this->year == dateTime.year;
		}
	}
}

#endif
